package com.situ.staff.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.situ.staff.bean.Staff;
import com.situ.staff.dao.StaffDao;
import com.situ.staff.service.StaffService;

@Service
public class StaffServiceImpl implements StaffService {

	@Autowired
	private StaffDao staffDao;

	/**
	 * 添加员工
	 */
	@Override
	public int add(Staff staff) {

		return staffDao.insert(staff);
	}

	/***
	 * 查询所有员工
	 */
	@Override
	public List getAll() {
		return staffDao.selectAll();
	}

	/**
	 * 根据id删除员工
	 */
	@Override
	public int remove(int id) {

		return staffDao.delete(id);
	}

	/**
	 * 根据id查询员工
	 */
	@Override
	public Staff getById(int id) {

		return staffDao.selectById(id);
	}

	/**
	 * 修改员工
	 */

	@Override
	public int update(Staff staff) {
		return staffDao.update(staff);
	}

	@Override
	public int getTotalCount() {

		return staffDao.getTotalCount();
	}

	@Override
	public List getByDeptId(Integer dept_id) {

		return staffDao.selectByDeptid(dept_id);
	}

}
